let http = require("http");
let users = [
  { id: 10, name: "John", age: 29 },
  { id: 20, name: "Tom", age: 39 },
  { id: 30, name: "sam", age: 49 },
];
let server = http.createServer((req, res) => {
  res.setHeader("Access-Control-Allow-Origin", "*");
  if (req.url === "/api/users") {
    res.end(JSON.stringify(users));
  } else {
    res.end("not found");
  }
});
server.listen(3666, () => {
  console.log("server running in 3666");
});
